<style lang="scss" scoped>
.informationBox {
  .informationA {
    width: 100%;
    height: 70px;
    padding: 10px;
    border-bottom: 1px solid #efefef;
    display: flex;
    align-items: center;
    img {
      border-radius: 10px;
      margin-right: 10px;
    }
    span {
      font-size: 16px;
      font-weight: bolder;
    }
  }
}
</style>
<template>
  <div class="informationBox">
    <van-nav-bar
      title="消息"
      right-text="全部以读回"
      left-arrow
      @click-left="$router.push('/home')"

    />
    <div class="informationA">
      <img src="../../assets/WechatIMG7166.jpg" alt="" />
      <span style="color: #b8ead8" @click="router.push('/systemmessage')">系统消息</span>
    </div>
    <div class="informationA">
      <img src="../../assets/WechatIMG7168.jpg" alt="" />
      <span style="color: #f984a2" @click="router.push('/consultationmessage')">问诊消息</span>
    </div>
    <div class="informationA">
      <img src="../../assets/WechatIMG7167.jpg" alt="" />
      <span style="color: #ffbf58" @click="router.push('/receiptmessage')">H币入账消息</span>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { request } from '../../axios/request'

// 跳转路由
const router = useRouter()

// 获取userId, sessionId
const doctorId = ref<number>(JSON.parse(localStorage.getItem('doctorId') || '""'));
const sessionId = ref<string>(JSON.parse(localStorage.getItem('sessionId') || '""'))

// 未读消息条数
const unreadMsg:any = ref(0)
const getUnread = async () => {
  await request
    .get('/api/health/doctor/verify/v1/findDoctorNoticeReadNum', {
      headers: {
        doctorId: doctorId.value as number,
        sessionId: sessionId.value as string
      }
    })
    .then((res) => {
      console.log(res.data)
      unreadMsg.value = res.data.result
      console.log(unreadMsg.value)
    })
}
getUnread()

// // 一键清空未读消息
// const clearMsg = async () => {
//   await request.put('/api/health/user/verify/v1/modifyAllStatus', {
//     headers: {
//       userId: userId.value as number,
//       sessionId: sessionId.value as string
//     }
//   }).then((res) => {
//     console.log(res.data, '123')
//     unreadMsg.value = 0
//     console.log(unreadMsg.value)
//   })
// }
// clearMsg()
</script>